from threading import Thread

num = 100


class SubThread1(Thread) :
    def run(self) :
        print('-----线程1-----')
        global num
        num += 50
        print('线程1计算结果%d :'%num)

class SubThread2(Thread) :
    def run(self) :
        print('-----线程2-----')
        global num
        num -= 100
        print('线程2计算结果%d :' % num)

if __name__ == '__main__' :
    print('---主线程开启--------')
    print('num:%d'% num)
    t1 = SubThread1()
    t2 = SubThread2()
    t1.start()
    t2.start()
    t1.join()
    t2.join()
    print('num:%d' % num)
    print('---主线程结束---------')
